/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page0={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        page.ui.on('pointerdown',function (e) {
            page.ui.interactive=false;
            page.ui.parent.removeChild(page.ui)
            document.getElementById('div_video').style.zIndex=4;
            document.getElementById('mVideo').play();
            document.getElementById('mVideo').style.width=740*pixiStage.scale.x+'px';
            document.getElementById('mVideo').style.height=1136*pixiStage.scale.y+'px';
            document.getElementById('mVideo').style.position='absolute';
            document.getElementById('mVideo').style.left= pixiStage.scale.x*-10+pixiStage.x+'px';
            document.getElementById('mVideo').style.top= pixiStage.scale.y*0+pixiStage.y+'px';
            // document.getElementById('div_video').style.width=740*pixiStage.scale.x+'px';
            // document.getElementById('div_video').style.height=1136*pixiStage.scale.y+'px';
            // document.getElementById('div_video').style.left= pixiStage.scale.x*0+pixiStage.x+'px';
            // document.getElementById('div_video').style.top= pixiStage.scale.y*0+pixiStage.y+'px';

            var md=document.getElementsByTagName("video")[0];
            md.addEventListener("ended",function(){
                setTimeout(function () {
                    document.dispatchEvent(new CustomEvent('Game_PageIn',{'detail':0}));
                    document.getElementById('div_2d').style.zIndex=6;
                    document.getElementById('div_video').style.zIndex=5;
                },1500)

            });

            ripples.pop();
        });
        var ob=Easy.CreateJSONGroup(json_group0,page.ui);
        for(var i in ob)
        {
            if(ob[i]!=ob.p0_bg)
            {
                ob[i].alpha=0;
                ob[i].orignY=ob[i].y;
                ob[i].y+=40;

            }
        }

        var bg1=Easy.CreateSprite('assets/images/p0_bg1.png',370,973,0.5,0.5,1);
        page.ui.addChild(bg1);
        page.ui.addChild(ob.p0_t3);
        page.ui.addChild(ob.p0_t4);

        var click=Easy.CreateSprite('assets/images/click.png',370,1058,0.5,0.5,1);
        page.ui.addChild(click);
        TweenMax.to(click.scale,0.7,{yoyo:true,repeat:-1,x:0.85,y:0.85,ease:Cubic.easeInOut});

        page.In=function () {
            // ob.p0_bg.scale.set(1.1);
            console.log('in');
            TweenMax.to(ob.p0_bg,0.1,{alpha:1});
            TweenMax.to(ob.p0_t0,1,{delay:0.2*0,alpha:1,y:ob.p0_t0.orignY,ease:Cubic.easeInOut});
            TweenMax.to(ob.p0_t1,1,{delay:0.2*1,alpha:1,y:ob.p0_t1.orignY,ease:Cubic.easeInOut});
            TweenMax.to(ob.p0_t2,1,{delay:0.2*2,alpha:1,y:ob.p0_t2.orignY,ease:Cubic.easeInOut});
            TweenMax.to(ob.p0_t3,1,{delay:0.2*3,alpha:1,y:ob.p0_t3.orignY,ease:Cubic.easeInOut});
            TweenMax.to(ob.p0_t4,1,{delay:0.2*4,alpha:1,y:ob.p0_t4.orignY,ease:Cubic.easeInOut});

            click.alpha=0;
            TweenMax.to(click,1,{delay:2.5,alpha:1});

            setTimeout(function () {
                page.ui.interactive=true;
            },3000);

            var ripple=new Ripple(400,400,bg1);
            ripples.push(ripple);
            bg1.filters = ripples.map(function (element) {
                return element.filter;
            });
        }
        page.Out=function () {
            console.log('out');
        }

       
    return page;
    }
}